import React from 'react'
import { Table, Icon, Switch, Radio, Form, Divider, Popconfirm,Pagination } from 'antd';
import {inject, observer} from "mobx-react/index";
import Tip from "../../common/tip"
import {Link} from "react-router-dom"

@inject("store")
@observer
class ActivityList extends React.Component {
    componentDidMount = () => {
        this.props.store.actions.getApplies(this.props.id)
    }
    componentWillReceiveProps(nextProps) {
        if(nextProps.id!=this.props.id)
            this.props.store.app.getApplies(nextProps.id)
        }
    render(){
        let store = this.props.store
        let list=store.applies
        const page=store.page
        const columns = [
            {
                title: '姓名',
                dataIndex: 'userName',
                key: 'userName',
            }, {
                title: '联系电话',
                dataIndex: 'userPhone',
                key: 'userPhone',
            },{
                title: '报名时间',
                dataIndex: 'createTime',
                key: 'createTime',
            }, {
                title: '部门',
                dataIndex: 'userDepart',
                key: 'userDepart',
            },{
                title: '职务',
                dataIndex: 'userDuty',
                key: 'userDuty',
            }
        ];
        const footer=()=>{
            return (
                <span style={{color:"#888",fontSize:"12px"}}>共{store.total}条数据，每页显示{page.pageSize}条</span>
            )
        }
        return(
            <div>
                <Tip title="报名列表"/>
                <Table
                    columns={columns}
                    dataSource={Object.assign([],list)}
                    pagination={{
                        total: store.total,
                        pageSize: page.pageSize,
                        defaultPageSize: page.pageSize,
                        onChange:(page)=>store.actions.setCurrentPage(this.props.id,page)
                    }}
                    footer={footer}
                />
            </div>
        )
    }
}
export default  ActivityList